package com.qf.hospital.service.impl;

import com.qf.hospital.entity.Department;
import com.qf.hospital.mapper.DepartmentMapper;
import com.qf.hospital.service.DepartmentService;
import com.qf.hospital.vo.DepartmentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zjw
 * @description
 * @date 2021/10/20 11:44
 */
@Service
public class DepartmentServiceImpl implements DepartmentService {

    @Autowired
    private DepartmentMapper departmentMapper;

    @Override
    public List<DepartmentVO> selectDepartment() {
        List<Department> departmentList = departmentMapper.selectByExample(null);

        List<DepartmentVO> data = new ArrayList<>();
        for (Department department : departmentList) {
            DepartmentVO vo = new DepartmentVO(department.getDepartmentId(),department.getDepartment());
            data.add(vo);
        }
        return data;
    }
}
